#include <cuda.h>
#include <cuda_runtime.h>

#include <iostream>
#include <string>
#include <map>

int dynamic_final_func(int);
void cuda_dynamic_lib_func(std::string&);

void test_functions()
{
  dynamic_final_func(42);

  std::string cuda_contents;
  cuda_dynamic_lib_func(cuda_contents);
  std::cout << cuda_contents << std::endl;
}

int main(int argc, char **argv)
{
  cudaError_t err;
  int nDevices = 0;
  err = cudaGetDeviceCount(&nDevices);
  if(err != cudaSuccess)
  {
    std::cout << "nDevices: " << nDevices << std::endl;
    std::cout << "err: " << err << std::endl;
    return 1;
  }
  std::cout << "this executable uses cuda code" << std::endl;
  std::cout << "and also uses dynamic libraries that have cuda code" << std::endl;
  std::cout << "you have " << nDevices << " devices that support cuda" << std::endl;

  test_functions();

  return 0;
}
